package com.woniuxy.proxy;

import com.woniuxy.service.UserSerivce;
import com.woniuxy.service.impl.UserServiceImpl;

public class UserProxy implements UserSerivce{
   private UserSerivce userSerivce;

    public UserProxy(UserSerivce userSerivce) {
        this.userSerivce = userSerivce;
    }
    @Override
    public void add(String name) {
        this.check();
        userSerivce.add(name);
        this.log();
    }
    @Override
    public void delete() {
        this.check();
        userSerivce.delete();
        this.log();
    }
    public void check(){
        System.out.println("检查权限");
    }
    public void log(){
        System.out.println("日志记录");
    }
}
